package com.hanthink.web.controller.app.report;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hanthink.common.annotation.Log;
import com.hanthink.common.core.controller.BaseController;
import com.hanthink.common.core.domain.AjaxResult;
import com.hanthink.common.enums.BusinessType;
import com.hanthink.system.domain.report.Applyextension;
import com.hanthink.system.service.report.IApplyextensionService;
import com.hanthink.common.utils.poi.ExcelUtil;
import com.hanthink.common.core.page.TableDataInfo;

/**
 * -Controller
 * 
 * @author lizhao
 * @date 2024-11-19
 */
@RestController
@RequestMapping("/Applyextension")
public class ApplyextensionController extends BaseController
{
    @Autowired
    private IApplyextensionService applyextensionService;

    /**
     * 查询-列表
     */
    @PreAuthorize("@ss.hasPermi('system:Applyextension:list')")
    @GetMapping("/list")
    public TableDataInfo list(Applyextension applyextension)
    {
        startPage();
        List<Applyextension> list = applyextensionService.selectApplyextensionList(applyextension);
        return getDataTable(list);
    }

    /**
     * 导出-列表
     */
    @PreAuthorize("@ss.hasPermi('system:Applyextension:export')")
    @Log(title = "-", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Applyextension applyextension)
    {
        List<Applyextension> list = applyextensionService.selectApplyextensionList(applyextension);
        ExcelUtil<Applyextension> util = new ExcelUtil<Applyextension>(Applyextension.class);
        return util.exportExcel(list, "Applyextension");
    }

    /**
     * 获取-详细信息
     */
    @GetMapping(value = "/{id}")
    @CrossOrigin
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(applyextensionService.selectApplyextensionById(id));
    }

    /**
     * 新增-
     */
    @PreAuthorize("@ss.hasPermi('system:Applyextension:add')")
    @Log(title = "-", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Applyextension applyextension)
    {
        return toAjax(applyextensionService.insertApplyextension(applyextension));
    }

    /**
     * 修改-
     */
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody Applyextension applyextension)
    {
        return toAjax(applyextensionService.updateApplyextension(applyextension));
    }

    /**
     * 删除-
     */
    @PreAuthorize("@ss.hasPermi('system:Applyextension:remove')")
    @Log(title = "-", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(applyextensionService.deleteApplyextensionByIds(ids));
    }
}
